//microcommand define md5占卜
signature("<问题:el>", "", { showWarnings: true, checkUnknown: true })
alias("md5-divine")
action(async ({ session }, question) => {
if (Array.isArray(question)) question = h.select(question.join(""), "text, face").join("")
else question = h.escape(question)
if (!question) return "无效输入…"
const time = new Date(Date.now() + 28800000)
const digest = require("crypto").createHmac("md5", "这是盐").update([question, session.userId, time.toISOString().split(":")[0]].join("\u0000")).digest()
const digit = digest[6] & 15
const level = (digit + 2) >> 2
return `<p>${session.text(".question", [question])}</p><p>${session.text(".user", [(n => n && `\u2068${n}\u2069`)((u => u.name || u.username || "")(await session.bot.getUser(session.userId))), session.userId])}</p><p>${session.text(".time", [time.getUTCFullYear(), time.getUTCMonth() + 1, time.getUTCDate(), time.getUTCHours()])}</p><p>${session.text(".result", { level: h.parse(session.text(".result-" + level)), stars: "★".repeat(5 - level) + "☆".repeat(level), digit: digit.toString(16) })}</p>`
})
locale("zh-CN", { description: "", arguments: { 问题: "问题" }, messages: { invalid: "无效输入…", question: "问题：{0}", user: "账号：{0}（{1}）", time: "时间：{0}年{1}月{2}日{3}时", result: "结果：{level}{stars}（{digit}）", "result-0": "大吉", "result-1": "吉", "result-2": "中", "result-3": "凶", "result-4": "大凶" } })